package com.yb.guigu.pick.code.generator.controller;

import com.yb.guigu.pick.core.bean.GuiguResult;
import com.yb.guigu.pick.core.constant.RabbitMQConstant;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright (C), 2022-2023, 姚兵
 * Author: 32210
 * Date: 2023/6/11 21:34
 * FileName: RabbitSendController
 * Description:
 */

@RestController
public class RabbitSendController {
    @Autowired
    RabbitTemplate rabbitTemplate;

    @GetMapping("/send")
    public GuiguResult send(@RequestParam String msg){
        rabbitTemplate.convertAndSend(RabbitMQConstant.EmailQueueConstant.EXCHANGE,RabbitMQConstant.EmailQueueConstant.ROUTING_KEY,msg);
        return GuiguResult.success();
    }
}
